package com.camel.docker.entity;

import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.camel.core.entity.BasePaginationEntity;
import com.camel.core.model.SysUser;
import com.camel.docker.enums.ZsStatus;
import com.github.dockerjava.api.model.Container;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author baily
 * @since 2020-10-16
 */
@Data
public class Project extends BasePaginationEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 容器名称
     */
    private String name;
    /**
     * 端口
     */
    private String ports;
    /**
     * 环境变量
     */
    private String envs;
    /**
     * 镜像
     */
    private String image;
    /**
     * 启动类型
     */
    private Integer startType;
    /**
     * GIT地址
     */
    private String addr;
    /**
     * 启动指令
     */
    private String directive;
    /**
     * 卷
     */
    private String volumes;
    /**
     * 工作目录
     */
    private String workDir;
    /**
     * 仓库ID
     */
    private Integer repositoryId;

    @TableField(exist = false)
    private List<Container> containers;

    /**
     * 创建时间
     */
    private Date createdAt;
    /**
     * 创建人
     */
    @TableField(exist = false)
    private SysUser creator;

    @TableField(value = "creator")
    private Integer creatorId;
    /**
     * 状态
     */
    @TableLogic
    private ZsStatus status;

    @Override
    public String toString() {
        return "Container{" +
        ", id=" + id +
        ", name=" + name +
        ", ports=" + ports +
        ", envs=" + envs +
        ", image=" + image +
        ", startType=" + startType +
        ", addr=" + addr +
        ", directive=" + directive +
        ", volumes=" + volumes +
        ", workDir=" + workDir +
        ", repositoryId=" + repositoryId +
        "}";
    }
}
